/*******************************************************************************
 * Package: com.hadoop.hdfs
 * Type:    WorkCountMapper
 * Date:    2024-05-13 22:35
 *
 * Copyright (c) 2024 LTD All Rights Reserved.
 *
 * You may not use this file except in compliance with the License.
 *******************************************************************************/
package com.hadoop.hdfs;

import java.util.Arrays;
import java.util.Map;
import java.util.Objects;

/**
 * 功能描述：
 *
 * @author Songxianyang
 * @date 2024-05-13 22:35
 */
public class WorkCountMapper {
    public void processingOfData(String line, CacheMap cacheMap) {
        String[] split = line.split("\\|");
        System.out.println("------>>>>>" + Arrays.asList(split));
        for (String s : split) {
            if (Objects.isNull(cacheMap.getValue(s))) {
                cacheMap.put(s, 1);
            } else {
                cacheMap.put(s, cacheMap.getValue(s) + 1);
            }
        }
    }
}
